<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>生日快乐</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: '微软雅黑', Arial, sans-serif;
            background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
            overflow: hidden;
            position: relative;
        }
        
        .container {
            z-index: 10;
            padding: 20px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            max-width: 90%;
            width: 500px;
        }
        
        h1 {
            color: #ff6b6b;
            font-size: 2.5rem;
            margin-bottom: 20px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
        }
        
        /* 轮播图样式 */
        .slideshow-container {
            position: relative;
            max-width: 100%;
            margin: 20px auto;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        
        .slide {
            display: none;
            width: 100%;
        }
        
        .slide img {
            width: 100%;
            vertical-align: middle;
        }
        
        .fade {
            animation-name: fade;
            animation-duration: 1.5s;
        }
        
        @keyframes fade {
            from {opacity: .4}
            to {opacity: 1}
        }
        
        /* 上一张/下一张按钮 */
        .prev, .next {
            cursor: pointer;
            position: absolute;
            top: 50%;
            width: auto;
            padding: 16px;
            margin-top: -22px;
            color: white;
            font-weight: bold;
            font-size: 18px;
            transition: 0.6s ease;
            border-radius: 0 3px 3px 0;
            user-select: none;
            background-color: rgba(0,0,0,0.3);
        }
        
        .next {
            right: 0;
            border-radius: 3px 0 0 3px;
        }
        
        .prev:hover, .next:hover {
            background-color: rgba(0,0,0,0.8);
        }
        
        /* 图片数量指示器 */
        .dot-container {
            text-align: center;
            padding: 10px;
        }
        
        .dot {
            cursor: pointer;
            height: 15px;
            width: 15px;
            margin: 0 2px;
            background-color: #bbb;
            border-radius: 50%;
            display: inline-block;
            transition: background-color 0.6s ease;
        }
        
        .active {
            background-color: #ff6b6b;
        }
        
        .dot:hover {
            background-color: #717171;
        }
        
        p {
            font-size: 1.2rem;
            color: #555;
            line-height: 1.6;
        }
        
        .message {
            font-size: 1.5rem;
            color: #ff6b6b;
            font-weight: bold;
            margin: 20px 0;
        }
        
        .music-controls {
            margin-top: 20px;
            display: flex;
            justify-content: center;
            gap: 15px;
            flex-wrap: wrap;
        }
        
        .music-btn {
            padding: 12px 20px;
            background-color: #ff6b6b;
            color: white;
            border: none;
            border-radius: 30px;
            font-size: 1rem;
            cursor: pointer;
            transition: all 0.3s ease;
            min-width: 120px;
        }
        
        .music-btn:hover {
            background-color: #ff5252;
            transform: scale(1.05);
        }
        
        .music-status {
            margin-top: 10px;
            font-weight: bold;
            color: #ff6b6b;
            height: 24px;
        }
        
        .bubbles {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 1;
        }
        
        .bubble {
            position: absolute;
            bottom: -50px;
            width: 40px;
            height: 40px;
            background: rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            animation: float 15s infinite ease-in;
        }
        
        .bubble:nth-child(1) {
            left: 10%;
            animation-delay: 0s;
            width: 20px;
            height: 20px;
        }
        
        .bubble:nth-child(2) {
            left: 20%;
            animation-delay: 1s;
            width: 30px;
            height: 30px;
        }
        
        .bubble:nth-child(3) {
            left: 35%;
            animation-delay: 3s;
        }
        
        .bubble:nth-child(4) {
            left: 50%;
            animation-delay: 6s;
            width: 50px;
            height: 50px;
        }
        
        .bubble:nth-child(5) {
            left: 65%;
            animation-delay: 2s;
        }
        
        .bubble:nth-child(6) {
            left: 80%;
            animation-delay: 4s;
            width: 25px;
            height: 25px;
        }
        
        .bubble:nth-child(7) {
            left: 90%;
            animation-delay: 5s;
            width: 15px;
            height: 15px;
        }
        
        @keyframes float {
            0% {
                bottom: -100px;
                transform: translateX(0);
            }
            50% {
                transform: translateX(100px);
            }
            100% {
                bottom: 100%;
                transform: translateX(-200px);
            }
        }
        
        @media (max-width: 768px) {
            h1 {
                font-size: 2rem;
            }
            
            .message {
                font-size: 1.2rem;
            }
            
            p {
                font-size: 1rem;
            }
            
            .container {
                padding: 15px;
            }
            
            .prev, .next {
                padding: 8px;
                font-size: 14px;
                margin-top: -20px;
            }
            
            .music-btn {
                padding: 10px 15px;
                font-size: 0.9rem;
                min-width: 100px;
            }
        }
        
        @media (max-width: 480px) {
            h1 {
                font-size: 1.8rem;
            }
            
            .message {
                font-size: 1.1rem;
            }
            
            p {
                font-size: 0.9rem;
            }
            
            .music-btn {
                padding: 8px 12px;
                font-size: 0.85rem;
                min-width: 90px;
            }
        }
    </style>
</head>
<body>
    <div class="bubbles">
        <div class="bubble"></div>
        <div class="bubble"></div>
        <div class="bubble"></div>
        <div class="bubble"></div>
        <div class="bubble"></div>
        <div class="bubble"></div>
        <div class="bubble"></div>
    </div>
    
    <div class="container">
        <h1>🎉 生日快乐! 🎉</h1>
        
        <!-- 轮播图 -->
        <div class="slideshow-container">
            <div class="slide fade">
                <img src="https://images.unsplash.com/photo-1592103447694-dfe63b16875b?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80" alt="生日蛋糕1">
            </div>
            
            <div class="slide fade">
                <img src="https://images.unsplash.com/photo-1542838132-92c53300491e?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80" alt="生日蛋糕2">
            </div>
            
            <div class="slide fade">
                <img src="https://images.unsplash.com/photo-1592103457545-b35497d0de5c?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80" alt="生日蛋糕3">
            </div>
            
            <a class="prev" onclick="plusSlides(-1)">❮</a>
            <a class="next" onclick="plusSlides(1)">❯</a>
        </div>
        
        <div class="dot-container">
            <span class="dot" onclick="currentSlide(1)"></span>
            <span class="dot" onclick="currentSlide(2)"></span>
            <span class="dot" onclick="currentSlide(3)"></span>
        </div>
        
        <div class="message">祝你生日快乐，天天开心！</div>
        <p>愿你的每一天都像今天一样特别，愿你的每一个愿望都能实现。祝你身体健康，工作顺利，心想事成！</p>
        
        <div class="music-controls">
            <button class="music-btn" id="playBtn" onclick="playMusic()">▶ 播放音乐</button>
            <button class="music-btn" id="pauseBtn" onclick="pauseMusic()">⏸ 暂停音乐</button>
        </div>
        <div class="music-status" id="musicStatus">音乐已暂停</div>
        
        <audio id="birthdaySong" loop>
            <source src="https://music.163.com/song/media/outer/url?id=285219.mp3" type="audio/mpeg">
        </audio>
    </div>

    <script>
        const audio = document.getElementById('birthdaySong');
        const playBtn = document.getElementById('playBtn');
        const pauseBtn = document.getElementById('pauseBtn');
        const musicStatus = document.getElementById('musicStatus');
        let slideIndex = 0;
        showSlides();
        
        function playMusic() {
            audio.play()
                .then(() => {
                    musicStatus.textContent = "正在播放生日歌...";
                })
                .catch(e => {
                    console.log("音乐播放失败: " + e);
                    musicStatus.textContent = "播放失败，请重试";
                    alert("音乐播放失败，请确保网络连接正常后重试");
                });
        }
        
        function pauseMusic() {
            audio.pause();
            musicStatus.textContent = "音乐已暂停";
        }
        
        function plusSlides(n) {
            showSlide(slideIndex += n);
        }
        
        function currentSlide(n) {
            showSlide(slideIndex = n);
        }
        
        function showSlide(n) {
            let i;
            let slides = document.getElementsByClassName("slide");
            let dots = document.getElementsByClassName("dot");
            
            if (n > slides.length) {slideIndex = 1}
            if (n < 1) {slideIndex = slides.length}
            
            for (i = 0; i < slides.length; i++) {
                slides[i].style.display = "none";
            }
            
            for (i = 0; i < dots.length; i++) {
                dots[i].className = dots[i].className.replace(" active", "");
            }
            
            slides[slideIndex-1].style.display = "block";
            dots[slideIndex-1].className += " active";
        }
        
        function showSlides() {
            let i;
            let slides = document.getElementsByClassName("slide");
            let dots = document.getElementsByClassName("dot");
            
            for (i = 0; i < slides.length; i++) {
                slides[i].style.display = "none";
            }
            
            slideIndex++;
            
            if (slideIndex > slides.length) {slideIndex = 1}
            
            for (i = 0; i < dots.length; i++) {
                dots[i].className = dots[i].className.replace(" active", "");
            }
            
            slides[slideIndex-1].style.display = "block";
            dots[slideIndex-1].className += " active";
            setTimeout(showSlides, 3000); // 每3秒切换一次图片
        }
        
        // 页面加载完成后初始化
        window.addEventListener('load', function() {
            // 在移动端可能需要用户交互后才能播放
            document.body.addEventListener('touchstart', function() {
                // 不自动播放，等待用户主动点击
            }, {once: true});
        });
    </script>
</body>
</html>